﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using Nissen_Model;

namespace Nissen_Dao
{
	public class TestMapDao: DaoBase
	{

		public IList<TestMap> GetTestMaps()
		{
			using (ISession session = this.SessionFactory.OpenSession())
			{
				ICriteria crt = session.CreateCriteria<TestMap>();

				return crt.List<TestMap>();
			}
		}

		public void SaveOrUpdate(IList<TestMap> testMaps)
		{
			using (ISession session = this.SessionFactory.OpenSession())
			{
				using (ITransaction t1 = session.BeginTransaction())
				{
					foreach (var testMap in testMaps)
					{
						session.SaveOrUpdate(testMap);
					}
					t1.Commit();
				}

			}
		}
	}
}
